package net.zrnecko.bowlingnumbers.session;

import net.zrnecko.bowlingnumbers.entity.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.List;
import java.util.Arrays;

@Name("alleyList")
public class AlleyList extends EntityQuery {

	private static final String[] RESTRICTIONS = {
			"lower(alley.description) like concat(lower(#{alleyList.alley.description}),'%')",
			"lower(alley.name) like concat(lower(#{alleyList.alley.name}),'%')",};

	private Alley alley = new Alley();

	@Override
	public String getEjbql() {
		return "select alley from Alley alley";
	}

	@Override
	public Integer getMaxResults() {
		return 25;
	}

	public Alley getAlley() {
		return alley;
	}

	@Override
	public List<String> getRestrictions() {
		return Arrays.asList(RESTRICTIONS);
	}

}
